package org.youyee.game.display
{
	import flash.display.Bitmap;
	import org.youyee.game.utils.bitmapCacheUtils.BitmapCacheFrame;

	public class BitmapCacheFrameViewer extends Bitmap
	{
		protected var _frameData:BitmapCacheFrame;
		
		/**
		 * 构造函数 
		 * @param smoothing 是否开启位图平滑效果
		 * 
		 */		
		public function BitmapCacheFrameViewer(smoothing:Boolean)
		{
			super(null, "auto", smoothing);
		}
		
		/**
		 * 设置当前需要显示的数据 
		 * @param value
		 * 
		 */		
		public function set bitmapCacheFrame(value:BitmapCacheFrame):void
		{
			if (value != _frameData)
			{
				this._frameData = _frameData;
				this.bitmapData = value.bitmapData;
				this.x = value.positionPoint.x;
				this.y = value.positionPoint.y;
			}
		}
		
		/**
		 * 获取当前显示的数据 
		 * @return 
		 * 
		 */		
		public function get bitmapCacheFrame():BitmapCacheFrame
		{
			return this._frameData;
		}
		
		/**
		 * 销毁
		 * 
		 */
		public function destroy():void
		{
			this.bitmapData = null;
			this._frameData = null;
		}
	}
}